package blog.pic;

import java.net.Proxy;
import java.util.ArrayList;
import java.util.List;

import com.blue.core.util.JsonUtil;
import com.blue.crawler.annotation.CrawlerConfig;
import com.blue.crawler.download.Download;
import com.blue.crawler.download.FileDownload;
import com.blue.crawler.model.FileModel;

public class MmjpgDownloadMain
{
	public MmjpgDownloadMain()
	{
	}
	
	public static void main(String[] args) throws Exception
	{
		List<String> urlList = new ArrayList<>();
		urlList.add("http://img.mmjpg.com/2018/1259/2i19.jpg");
		urlList.add("http://img.mmjpg.com/2018/1259/3iqv.jpg");
		urlList.add("http://img.mmjpg.com/2018/1259/1ily.jpg");
		urlList.add("http://img.mmjpg.com/2018/1259/4irz.jpg");
		urlList.add("http://img.mmjpg.com/2018/1259/5irx.jpg");
		
		CrawlerConfig config = new CrawlerConfig();
		config.setThumbHeight(200);
		config.setThumbWidth(200);
		config.setProxy(true);
		config.setProxyHost("localhost");
		config.setProxyPort(7070);
		config.setProxyType(Proxy.Type.SOCKS);
		
		Download download = new FileDownload("/opt");
		for (String url : urlList)
		{
			FileModel fileModel = new FileModel();
			fileModel.setUrl(url);
			fileModel.setReferer("http://www.mmjpg.com/mm/1259");
			fileModel = download.download(fileModel, config);
			System.out.println(JsonUtil.output(fileModel));
			Thread.sleep(3000);
		}
		
	}
	
}
